#include <algorithm>
#include <cstdio>
#include <iostream>
using namespace std;

#define MAX 2100100
#define MOD 998244353

// 快速幂函数
int fpow(int a, int b) {
  int s = 1;
  while (b) {
    if (b & 1)
      s = 1ll * s * a % MOD;
    a = 1ll * a * a % MOD;
    b >>= 1;
  }
  return s;
}

int r[MAX], W[MAX], K[MAX];

// 数论变换 (NTT)
void NTT(int *p, int opt, int len) {
  int l = 0, N = 1;
  for (N = 1; N < len; N <<= 1)
    ++l;
  for (int i = 0; i < N; ++i)
    r[i] = (r[i >> 1] >> 1) | ((i & 1) << (l - 1));
  for (int i = 0; i < N; ++i)
    if (i < r[i])
      swap(p[i], p[r[i]]);
  for (int i = 1; i < N; i <<= 1) {
    int w = fpow(3, (MOD - 1) / (i << 1));
    W[0] = 1;
    for (int k = 1; k < i; ++k)
      W[k] = 1ll * W[k - 1] * w % MOD;
    for (int j = 0; j < N; j += i << 1)
      for (int k = 0; k < i; ++k) {
        int X = p[j + k], Y = 1ll * W[k] * p[i + j + k] % MOD;
        p[j + k] = (X + Y) % MOD;
        p[i + j + k] = (X - Y + MOD) % MOD;
      }
  }
  if (opt == -1) {
    reverse(&p[1], &p[N]);
    for (int i = 0, inv = fpow(N, MOD - 2); i < N; ++i)
      p[i] = 1ll * p[i] * inv % MOD;
  }
}

int n, a[MAX], b[MAX], c[MAX];
long long ans;

int main() {
  scanf("%d", &n);
  for (int i = 1; i <= n; ++i)
    scanf("%d", &a[i]);

  int L = 0;
  for (int i = 1; i <= n; ++i)
    b[a[i]] = 1, L = max(L, a[i]);

  int N;
  for (N = 1; N <= L + L; N <<= 1)
    ;

  NTT(b, 1, N);
  for (int i = 0; i < N; ++i)
    c[i] = 1ll * b[i] * b[i] % MOD;
  NTT(c, -1, N);

  for (int i = 1; i <= n; ++i)
    ans += (c[a[i] * 2] - 1) / 2;

  cout << ans << endl;
  return 0;
}